/* ========================================================================= */
/* ------------------------------------------------------------------------- */
/*!
  \file			alayid.h
  \date			Sep 2012
  \author		TNick

  \brief		Contains the definition for ALayID class


*//*


 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Please read COPYING and README files in root folder
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
/* ------------------------------------------------------------------------- */
/* ========================================================================= */
#ifndef __ALAYID_INC__
#define __ALAYID_INC__
//
//
//
//
/*  INCLUDES    ------------------------------------------------------------ */

#include	<QList>
#include	<cpg/atoms/pgatomicchg.h>

/*  INCLUDES    ============================================================ */
//
//
//
//
/*  CLASS    --------------------------------------------------------------- */

namespace	BBlocks		{

class	UserMsg;

}


namespace	cpg		{

class	PgLayer;
class	PgItTree;

/**
*	@brief	Atomic change that allows creating/deleting a layer
*/
class CPGSHARED_EXPORT ALayID	: public AtomicChg			{
	BBM_TRACK( ALayID );

	//
	//
	//
	//
	/*  DEFINITIONS    ----------------------------------------------------- */

	/*  DEFINITIONS    ===================================================== */
	//
	//
	//
	//
	/*  DATA    ------------------------------------------------------------ */

private:


	/**
	*	@brief	the layer that is created / deleted
	*/
	PgLayer *			new_layer_;


	/**
	*	@brief	for global layers, holds the space components
	*/
	QList<PgItTree*>	spc_comp_;


	/*  DATA    ============================================================ */
	//
	//
	//
	//
	/*  FUNCTIONS    ------------------------------------------------------- */

private:


	/**
	*	@brief	constructor;
	*/
	ALayID				( CpgDoc * doc );


	/**
	*	@brief	destructor;
	*/
	~ALayID				( void );


	/**
	*	@brief	recreate the effect of this change
	*/
	void				redoAtom			( void )
	{ doUndoRedo( !isReversed() ); }


	/**
	*	@brief	undo the effect of this change
	*/
	void				undoAtom			( void )
	{ doUndoRedo( isReversed() ); }


	/**
	*	@brief	undo the effect of this change
	*/
	void				doUndoRedo			( bool b_effect );


	/**
	*	@brief	is this the delete variant or the create variant
	*/
	inline bool			isDeleteVariant		( void ) const
	{ return isReversed(); }


public:


	/**
	*	@brief	short description for this action
	*/
	QString				shortDescr			( void ) const
	{ return ( isReversed() ?
				   QObject::tr( "Create layer" ) :
				   QObject::tr( "Delete layer" ) );   }



public:


	/**
	*	@brief	inserts the layer in provided space
	*/
	static ALayID *		createLayer			(
			BBlocks::UserMsg &			um,
			PgSpace *					space,
			PgLayer *					layer
			);


	/**
	*	@brief	deletes the layer from provided space
	*/
	static ALayID *		deleteLayer			(
			BBlocks::UserMsg &			um,
			PgSpace *					space,
			PgLayer *					layer
			);


	/*  FUNCTIONS    ======================================================= */
	//
	//
	//
	//

};	/*	class ALayID	*/

/*  CLASS    =============================================================== */
//
//
//
//

}	//	namespace	cpg

#endif // __ALAYID_INC__
/* ------------------------------------------------------------------------- */
/* ========================================================================= */
